[RF] Avoid expensive double loop in setData() for likelihooods#19529
Merged
guitargeek merged 1 commit intoroot-project:masterfrom Aug 5, 2025
Merged
[RF] Avoid expensive double loop in setData() for likelihooods#19529guitargeek merged 1 commit intoroot-project:masterfrom
setData() for likelihooods#19529guitargeek merged 1 commit intoroot-project:masterfrom
Conversation
About 2 years ago in 85c5cb4, I made the mistake of introducing a potentially expensive double loop when setting the data for a likelihood: the `RooEvaluatorWapper` iterates over all data variables to set, and for each of them it calls `RooFit::Evaluator::setInput()`, which has a loop over all nodes in the computation graph to identify for which one the data is set. This caused a big performance hit when instantiating likelihoods with the new vectorizing CPU backend, manifesting in 10 minutes for `createNLL` for the big ATLAS Higgs combination benchmark instead of 1 min. This commit fixes the problem by caching all nodes in the compute graph in a hash map for fast lookup.
Test Results 21 files 21 suites 3d 10h 33m 17s ⏱️ Results for commit c1bea85. ♻️ This comment has been updated with latest results. |
lmoneta
approved these changes
Aug 5, 2025
Member
lmoneta
left a comment
There was a problem hiding this comment.
LGTM!
Thank you Jonas for fixing this!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
About 2 years ago in 85c5cb4, I made the mistake of introducing a potentially expensive double loop when setting the data for a likelihood: the
RooEvaluatorWapperiterates over all data variables to set, and for each of them it callsRooFit::Evaluator::setInput(), which has a loop over all nodes in the computation graph to identify for which one the data is set.This caused a big performance hit when instantiating likelihoods with the new vectorizing CPU backend, manifesting in 10 minutes for
createNLLfor the big ATLAS Higgs combination benchmark instead of 1 min.This commit fixes the problem by caching all nodes in the compute graph in a hash map for fast lookup.